/*
 * @Author: Yang qiuyou wangyi168359476@163.com
 * @Date: 2024-07-26 11:15:02
 * @LastEditors: Wang Shuo wangshuo@sgsimulation.com
 * @LastEditTime: 2024-08-30 10:30:37
 * @FilePath: \SGFEM\DataStructure\FEM\Constraint\include\RBAR1Data.h
 * @Description:  RBAR1单元数据定义
 *
 */

#pragma once

#include <vector>

#include "DataStructure/Common/DataStructureNamespace.h"
#include "DataStructure/Common/Id.h"
#include "DataStructure/Common/Real.h"
#include "DataStructure/Input/Element/ElementBase.h"
#include "DataStructure/Input/Solver/DOFDirections.h"

SG_DATASTRUCTURE_FEM_NAMESPACE_OPEN
/** @brief RBAR1 单元数据
 *
 * 主节点的六个自由度都是控制自由度，从节点的自由度不一定都被控制， 能够产生1-6个约束方程
 */
struct DECLSPEC RBAR1Data : public ElementBase
{
    SG::DataStructure::Common::Id   m_masterNode     = 0;    ///< 主节点编号
    SG::DataStructure::Common::Id   m_slaveNodes     = 0;    ///< 从节点
    SG::DataStructure::Common::I64  m_slaveDOFs      = 0;    ///< 从自由度集合
    SG::DataStructure::Common::Real m_alpha          = 0.0;  ///< 热膨胀系数
    SG::DataStructure::Common::Real m_refTemperature = 0.0;  ///< 参考温度
    SG::DataStructure::Common::Id   m_domainId       = 0;
    /**
     * @brief 获取从属自由度集合
     *
     * 返回从属自由度集合的实例。
     *
     * @return 从属自由度集合的实例
     */
    SG::DataStructure::FEM::DofSet GetSlaveDOFs () const;
    void                           SetSlaveDOFs (const SG::DataStructure::FEM::DofSet& dofs);
};

/// @brief 判断两个RBAR1Data是否相等
/// @param a
/// @param b
/// @return
DECLSPEC bool operator== (const RBAR1Data& a, const RBAR1Data& b);

SG_DATASTRUCTURE_FEM_NAMESPACE_CLOSE